home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / adpcm / rawdaudio.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  489b  |  30 lines

  1. /* testd - Test adpcm decoder */
  2.  
  3. #include "adpcm.h"
  4. #include <stdio.h>
  5.  
  6. struct adpcm_state state;
  7.  
  8. #define NSAMPLES 1000
  9.  
  10. char    abuf[NSAMPLES/2];
  11. short    sbuf[NSAMPLES];
  12.  
  13. main() {
  14.     int n;
  15.  
  16.     while(1) {
  17.     n = read(0, abuf, NSAMPLES/2);
  18.     if ( n < 0 ) {
  19.         perror("input file");
  20.         exit(1);
  21.     }
  22.     if ( n == 0 ) break;
  23.     adpcm_decoder(abuf, sbuf, n*2, &state);
  24.     write(1, sbuf, n*4);
  25.     }
  26.     fprintf(stderr, "Final valprev=%d, index=%d\n",
  27.         state.valprev, state.index);
  28.     exit(0);
  29. }
  30.